openarenafandomcom-20200216-history
Entities-only editing
It is possible to edit only the entities of a map. This avoids recompiling the entire map and can be very useful. For example: adding support for new gametypes or changing some kind of special item. Entity explanation Before explaining what an entity is, we should start with the explanation of map compilings. A .map file is a plain text file which contains the brush & entities data needed to make the map. At the compiling stage, the compiler look this file for the info it needs. Taken from Wikibooks, the entities are "object which interacts with the game in any way". Examples of them are light, (which makes the level to have light from the spot it's placed) the info_player_* entities, (which makes the player itself to spawn inside of the level in the location where it's placed) ammo_, (places an ammo box of in the level) weapon_. (does the same as ammo_ but with weapons instead of ammo boxes) and many others. To look at them in the editor, press n'', and select one. Below the list there's a description of what each one does. Examples of entities An entity inside of the .map file is composed by the following structure: ''{ "classname" "entityname" //The name of the entity. Look at entities.ent in \oa.game\baseoa for them and its info. REQUIRED. "origin" "X Y Z" //where X, Y and Z is the location of the item's origin on the map. REQUIRED. "property1" "value1" // Property 1 of the entity. "property2" "value2" // Property 2 of the entity. ... "propertyN" "valueN" // Property N of the entity. }'' If the entity is a brush, then one of the properties became a brush: ''{ "classname" "entityname" "origin" "X Y Z" "property1" "value1" "property2" "value2" ... ' "propertyN" "valueN" }'' The Worldspawn entity (the first one in the .map file) looks like this: ''//entity 0 {'' ''"classname" "worldspawn" "message" "GalMevish by Armageddon_Man" "music" "music/OA01.ogg" ... ' }'' Now let's go to the... How-to * First, its very recommended to use a plain-text advanced editor like Notepad++. You can use GEdit or Windows's Notepad anyways. * Put the bsp file you want to convert in the maps folder, inside of baseoa. (For example ''yourmap.bsp) * Open the bsp file with this editor, and search for the string "worldspawn". * When you find it, select everything from the first bracket ({) BEFORE worldspawn to the last you found before the binary stuff starts again. * Copy the selected text & close the BSP file (you'll need it later, so DON'T EDIT IT TOO) * Open a new file in your plain-text editor and paste the content. * Make the changes you want. * Save the file with the name yourmap.ent inside /maps folder. * Run q3map2 with the following commandline: q3map2 -onlyents yourmap.ent. This will take the map yourmap.bsp and make only changes to the entities. * Run bspc with the following commandline: bspc -reach yourmap.bsp. If the .aas file is present, it will only change the item reachings. * Test your map on the game to see if everything is right. * Repeat the last 5 steps until you are happy with the results. Tip: while in-game, you can use the \viewpos command to get your coordinates (x y z and facing angle). This may help you in positioning your entities. Some advices You should be careful with the selection of what you want to copypaste and the entity editing itself. As with the shaders, there's a syntax you MUST respect. For example, opening and closing brackets should be in one line. Also, in order to comply with GPLv2 license, it's highly recommendable to use the .map file as well. Use any *Radiant editor (or alternatively a text editor, but having a graphical interface may be more comfortable) to edit the entities in the .map file. Remember which entities you've worked on, and pay attention to the "origin" property in the Entities dialog (key N) as you're going to refer to it a lot. After working with the .map file, save it (or save a copy) and open the mapname.ent file. Edit the entities paying attention to both the .map and .ent file (in this case, the entities in the .ent file should match their counterparts the edited .map file has). Save the .ent file and compile as mentioned above. GPLv2 requires sources, and in this case the edited .map file counts as the source of the map. The .ent file, in spite of this importance, isn't necessary, since it's tied to a specific version of the map (the "edited" version) and in case of a huge overhaul or, at least, notable changes, these changes may render the .ent file obsolete and useless. A new .ent file must be created every time an entity-only editing takes place. Tip: *Radiant editors themselves usually include a "only entities" compiling option (in Q3Radiant, it's named "bsp_Entities"). This allows you to make the changes from the map editor, directly in the main .map file (no need to write a .ent file), then recompile it quickly by re-caluculating entities only! Of course, you should do this only in case you modified entities only, and did not modify brushes. Main utilities As mentioned above, this has a number of utilities, almost all of them without opening GTKRadiant. These are a few examples of the thousands of utilities of this method instead of opening GTKR: Making an entity to only spawn in X gametype Let's suppose that you want to add DOM support (Domination points & new startpoints) to your map. Make an entity at the end of the file and add to the bottom of the options the lines: {'' ''"classname" "domination_point" "message" "Lava Zone" "origin" "-256 -512 384" "gametype" "dom" }'' Entity replacement Another utility is to replace entities. For example, replacing a Rocket Launcher with a Railgun on a map: * Before: ''{ "classname" "weapon_rocketlauncher" "origin" "-256 -512 384" }'' * After: ''{ "classname" "weapon_railgun" "origin" "-256 -512 384" }'' Adding music without editing and compiling the map We can also add music to our level without editing the Worldspawn entity in GTKR: ''//entity 0 {'' ''"classname" "worldspawn" "message" "GalMevish by Armageddon_Man" "music" "music/OA01.ogg" ... '' ''} See also * Mapping resources & tutorials * Mapping information for special gametypes * Mapping Category:Development Category:Mapping